package com.x.client.bean

import android.os.Parcelable
import kotlinx.android.parcel.Parcelize


/**
 *  Creator : GG
 *  Time    : 2017/11/29
 *  Mail    : gg.jin.yu@gmail.com
 *  Explain :
 */
@Parcelize
data class CarStateBus(var brandId: Int? = null,
                       var seriesId: Int? = null,
                       var modelId: Int? = null,
                       var carOutColor: String? = null,
                       var carOrderState: Int? = null,
                       var carStockState: Int? = null,
                       var carBargainPriceState: Int? = null,
                       var carSaleState: Int? = null,
                       var carPledgeState: Int? = null,
                       var carDetectState: Int? = null,
                       var carAuthState: Int? = null,
                       var fromRetailPrice: Double? = null,
                       var toRetailPrice: Double? = null,
                       var fromRetailPriceIndex: Int? = null,
                       var toRetailPriceIndex: Int? = null,
                       var fromCarAge: Int? = null,
                       var toCarAge: Int? = null,
                       var fromCarAgeIndex: Int? = null,
                       var toCarAgeIndex: Int? = null,
                       var fromCreateTime: Int? = null,
                       var toCreateTime: Int? = null,
                       var fromCreateTimeIndex: Int? = null,
                       var toCreateTimeIndex: Int? = null,
                       var fromMileage: Int? = null,
                       var toMileage: Int? = null,
                       var fromMileageIndex: Int? = null,
                       var toMileageIndex: Int? = null,
                       var orderColunm: String? = null,
                       var orderMode: String? = null,
                       var carTitle: String? = null,
                       var sort: Int? = null,
                       var carTypeId: Int? = null,
                       var carTypeName: String? = null,
                       var marketId: String? = "1",
                       var pricePosition: Int? = 0,
                       var sortPosition: Int? = 0,
//                       var shopId: String? = App.instance.getUser()?.shopId,
//                       var userId: String? = App.instance.getUser()?.userId,
                       var shopName: String? = null,
                       var environ: String? = null,
                       var carVin6: String? = null,
                       var colorBean: ColorBean? = null
) : Parcelable {


//    变量名	含义	类型	备注
//    CAR_CREATE_TIME	创建时间
//    CAR_LICENCE_DATE	车龄
//    CAR_MILEAGE	里程
//    CAR_RETAIL_PRICE	零售价
//    CAR_SALE_TIME	上架时间
//    CAR_STOCK_TIME	库存时间（申请入库、入库时间）
//    ORDER_CREATE_TIME	车辆预订时间
//    SALE_CREATE_TIME	销售出库时间
//    升序：ASC，降序：DESC

    var sortType: String = UpdateNewest
        set(value) {
            field = value
            when (value) {
//                InGarageNewest -> {
//                    orderColunm = "CAR_SALE_TIME"
//                    orderMode = "DESC"
//                }
//                InGarageOldest -> {
//                    orderColunm = "CAR_SALE_TIME"
//                    orderMode = "ASC"
//                }
                UpdateNewest -> {
                    orderColunm = "CAR_CREATE_TIME"
                    orderMode = "DESC"
                }
//                UpdateOldest -> {
//                    orderColunm = "CAR_CREATE_TIME"
//                    orderMode = "ASC"
//                }
//                AppliedNewest -> {
//                    orderColunm = "CAR_STOCK_TIME"
//                    orderMode = "DESC"
//                }
//                AppliedOldest -> {
//                    orderColunm = "CAR_STOCK_TIME"
//                    orderMode = "ASC"
//                }
//                InWarehouseNewest -> {
//                    orderColunm = "CAR_STOCK_TIME"
//                    orderMode = "DESC"
//                }
//                InWarehouseOldest -> {
//                    orderColunm = "CAR_STOCK_TIME"
//                    orderMode = "ASC"
//                }
//                BookNewest -> {
//                    orderColunm = "ORDER_CREATE_TIME"
//                    orderMode = "DESC"
//                }
//                BookOldest -> {
//                    orderColunm = "ORDER_CREATE_TIME"
//                    orderMode = "ASC"
//                }
//                TransactionsNewest -> {
//                    orderColunm = "SALE_CREATE_TIME"
//                    orderMode = "DESC"
//                }
//                TransactionsOldest -> {
//                    orderColunm = "SALE_CREATE_TIME"
//                    orderMode = "ASC"
//                }
                PriceHighest -> {
                    orderColunm = "CAR_RETAIL_PRICE"
                    orderMode = "DESC"
                }
                PriceLowest -> {
                    orderColunm = "CAR_RETAIL_PRICE"
                    orderMode = "ASC"
                }
                LicenseDateShortest -> {
                    orderColunm = "CAR_LICENCE_DATE"
                    orderMode = "DESC"
                }
                MileageShortest -> {
                    orderColunm = "CAR_MILEAGE"
                    orderMode = "ASC"
                }
            }
        }

    companion object {

        const val UpdateNewest = "最新发布"
        const val PriceHighest = "价格最高"
        const val PriceLowest = "价格最低"
        const val LicenseDateShortest = "车龄最短"
        const val MileageShortest = "里程最短"
    }
}